package cn.tedu.javagame.ball;

public class Board {
    int x,y,width,height;
    public Board(){
        this.x = 200;
        this.y = 800;
        this.width = 500;
        this.height = 30;
    }
    public void move(int x){
        this.x = x-250;
        if(this.x<0){
            this.x=0;
        }
        if(this.x+500>BallFrame.WIDTH){
            this.x=BallFrame.WIDTH-500;
        }
    }
    public void catchBall(Ball ball){
        if(ball.x+ball.length/2>=this.x && ball.x+ball.length<=this.x+this.width){
            if(ball.y+ball.length >= this.y && ball.y+ball.length <= this.y + this.height){
                if (ball.state == 2){ball.state=1;}
                if (ball.state == 3){ball.state=0;}
            }
        }
        //没接住的球
//        if( || ){
//            ball.isDown = true;
//        }
    }
}
